#pragma once
#include "../include/sprite.hpp"
#include "../include/Tools.hpp"

#include "../include/enum.h"
#include <vector>

class SpritesManager;
class BackgroundManager;
class Application;

/*! \brief The Hero is a serie of sprites stacked up on each others. The animation is created by masking the sprites on after another

*/
class Hero :
	public Sprite
{
private:
	
	
	unsigned int	life;
	unsigned int	lifeMax;
	unsigned int	mana;
	unsigned int	manaMax;
	unsigned int	transformID;
	Screen			screen;
	SpritesManager* spritesManager;

	unsigned int	invincibleTicks;
	unsigned int	idSpriteDisplay;
	unsigned int	actualFrame;
	unsigned int	frameRate;
	bool			isJumping;
	unsigned int	heightJump;
	unsigned int	heightToGet;
	unsigned int	speedJump;
	unsigned int	posJump;
	JumpDirection	jumpDirection;
	int				nbFrameFlying;
	bool			doubleJump;
	bool			isFlying;
	bool			isInvincible;
	JumpDirection	flyDirection;
	int				nbFrameClimbing;
	int				timeClimbing;



public:
	/* Order of transformation in the charDatas array :
		0 : Human			
		1 : Vampire			4 : FatZombie
		2 : Zombie			5 : Werewolf	
		3 : Bat				6 : Hunter					*/
	std::vector<CharacterData*> charDatas; 

	std::vector<int> forbiddenTransfos;

	Hero(SpritesManager* _spritesManager, std::vector<int> _forbiddenTransfos);
	~Hero(void);
	void initTransformations();
	void initSpriteVisibility( unsigned int _transformID );
	void transformUP(BackgroundManager* backgroundManager);  
	void transformDOWN(BackgroundManager* backgroundManager); 

	void animate();
	void detectSwitchScreen();
	void jump();
	void fly();
	void updateMana();
	void updateHealth(int delta);
	void transform(unsigned int _transformID, BackgroundManager* backgroundManager);
	void eatEnemy();
	void loadCharData();

	inline unsigned int getHealth(){return life;};
	inline unsigned int getMana(){return mana;};
	inline unsigned int getHealthMax(){return lifeMax;};
	inline unsigned int getManaMax(){return manaMax;};
	inline bool getJumping(){return isJumping;};
	inline void setJumping(bool _isJumping){isJumping = _isJumping;};
	inline bool getFlying(){return isFlying;};
	inline bool getInvincible(){return isInvincible;};
	inline void setInvincible(bool _invincible){isInvincible = _invincible;};
	inline bool getDoubleJump(){return doubleJump;};
	inline JumpDirection getJumpDir(){return jumpDirection;};
	inline unsigned int getStrength(){ return charDatas[transformID]->strength; };
	inline unsigned int getTransformID(){ return transformID; };
	inline Screen getScreen(){return screen;};
	inline void setPosJump(unsigned int _posJump){posJump = _posJump;};
	inline void setJumpDirection(JumpDirection _jumpDir){jumpDirection = _jumpDir;};
	inline bool getJumpDirection(){return jumpDirection;};
	inline void setDoubleJump(bool _doubleJump){ doubleJump = _doubleJump;};
	inline unsigned int getInvincibleTicks(){return invincibleTicks;};
	inline void setInvincibleTicks(unsigned int _Ticks){ invincibleTicks += _Ticks; };
	inline void resetInvincibleTicks(){ invincibleTicks = 0; };
	inline void setFlying(bool _flying ){ isFlying = _flying;};
	

};

